package com.glsc.ngateway.common.base.domain.mysql.gateway.platform.it;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;


/**
 * 一级域名管理
 */
@Entity
@Data
@Table(name = "t_domian")
public class ItDomain implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int comment '唯一编号'")
    private Integer id;

    @Column(name = "domain", columnDefinition = "varchar(128) comment '域名'")
    private String domain;

    @Column(name = "service_provider", columnDefinition = "varchar(128) comment '域名运营商'")
    private String serviceProvider;

    @Column(name = "app_date", columnDefinition = "datetime comment '申请日期'")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate appDate;

//    private String appDateStart;
//
//    private String appDateEnd;

    @Column(name = "exp_date", columnDefinition = "datetime comment '有效日期'")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate expDate;

//    private String expDateStart;
//
//    private String expDateEnd;

    @Column(name = "administrator", columnDefinition = "varchar(128) comment '负责人账号'")
    private String administrator;

    @Column(name = "administrator_name", columnDefinition = "varchar(128) comment '负责人姓名'")
    private String administratorName;

    @Column(name = "use_to", columnDefinition = "varchar(512) comment '用途'")
    private String useTo;

    @Column(name = "state", columnDefinition = "varchar(128) comment '使用情况'")
    private String state;

    @Column(name = "ICP_state", columnDefinition = "varchar(128) comment '备案情况'")
    private String ICPstate;

    @Column(name = "icp_no", columnDefinition = "varchar(128) comment '备案号'")
    private String icpNo;

    @Column(name = "oa_account", columnDefinition = "varchar(128) comment '负责人oa账号'")
    private String oaAccount;

    @Column(name = "is_delete", columnDefinition = "int(2) DEFAULT 0 comment '是否删除'")
    private Integer isDelete;

    @Column(name = "insert_time", columnDefinition = "datetime comment '创建时间'")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime insertTime;

    @Column(name = "update_time", columnDefinition = "datetime comment '更新时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime updateTime;


}
